﻿#pragma once

#include "spdlog/spdlog.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/fmt/ostr.h"
extern std::shared_ptr<spdlog::logger> logger ;

#include <QDialog>
#include <QPushButton>
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QGridLayout"
#include "QVBoxLayout"
#include "QLabel"
#include "QSpinBox"
#include "show_qlabel.h"
#include "QComboBox"
#include <QTimer>
#include <QMutex>
#include "qt_graphics_view.h"

#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

#include <fstream>
#include "nlohmann/json.hpp"
using json = nlohmann::json;

#include "commonfunction.h"
extern QImage matToQImage(const Mat mat_in);


#include "camera_hk.h"
#include <QSettings>
class CameraHKQDialog : public QDialog
{
    Q_OBJECT

public:
	QSettings* m_qsettings;

    QString m_SN;//相机的SN
    QString m_camera_name;//相机的名字
    QString m_camera_type;//相机类型
    QString m_image_dir;//

    QString m_type;

	QtQGraphicsView * m_showqlable;

    QLabel * m_qlabel_message;
    QLabel * m_qlabel_exposure_time;
    QSpinBox * m_qspinbox_exposure_time;

    QLabel * m_qlabel_gain;
    QSpinBox * m_qspinbox_gain;

    QLabel   *   m_qlabel_trigger_mode;
    QComboBox*   m_qcombox_trigger_mode;




    QPushButton* m_qpushbutton_soft_triger;


    QPushButton* m_qpushbutton_save;
    QPushButton* m_qpushbutton_hide;


    cv::Mat m_image ;

    QString m_section   = "";

    QTimer* m_qtimer = nullptr;
    bool m_bool_show_image=false;


    HkCamera* m_camera_interface = new HkCamera();
public:
    explicit CameraHKQDialog(QDialog *parent, QSettings* qsettings, QString section);
    bool initCamera(QString type,QString name,CameraCallback pfunction, void *pcontext);
    void loadParameter();
    void saveParameter();
    void showImage(Mat image,int camera_index,int index);
    void softTrigger();
};
#pragma execution_character_set("utf-8")
